package com.an.framework.handler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.NoHandlerFoundException;

/**
 * ClassName: ControllerAdvisor <br/>
 * Function: 处理Spring的异常，控制器通知（增强），用来处理所有被@热quest Mapping修饰的方法抛出的一场. <br/>
 * Reason: 处理Spring的异常. <br/>
 * date: 2017年11月14日 上午10:41:17 <br/>
 *
 * @author atc
 * @version 1.0.0
 * @since JDK 1.8
 */
@ControllerAdvice
public class ControllerAdvisor {

	private static final Logger log = LoggerFactory.getLogger(ControllerAdvisor.class);
	
	@ExceptionHandler(NoHandlerFoundException.class)
	public String handle404(NoHandlerFoundException exception) {
		log.info("请求路径非法(404错误处理)，" + exception.getRequestURL());
		return "/framework/errorcodepage/error-404";
	}
}

